package it.uniroma2.art.coda.projectionrule.antlr.test;

import java.io.IOException;

import it.uniroma2.art.coda.pearl.parser.antlr.AntlrLexer;
import it.uniroma2.art.coda.pearl.parser.antlr.AntlrParser;

import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.TokenStream;
import org.antlr.runtime.tree.Tree;

public class TreeSimplePrint {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			String prPath = "esempioPR.pr";			
			CharStream charStream = new ANTLRFileStream(prPath);
			AntlrLexer lexer = new AntlrLexer(charStream);
			TokenStream token = new CommonTokenStream(lexer);
			AntlrParser parser = new AntlrParser(token);
			Tree tree = (Tree)parser.pearlUnit().getTree();
			System.out.println("tree = "+tree.toStringTree());
		} catch (IOException e) {
			e.printStackTrace();
		} catch (RecognitionException e) {
			e.printStackTrace();
		}

	}

}
